<script>
  import config from './config'
  import store from '@/store'
  import { getAccessToken } from '@/utils/auth'

  export default {
	globalData: {
	  	// ip: 'http://39.101.66.76/admin-api'
	  	// ipTwo: 'http://39.101.66.76/app-api'
	  	// ip: 'http://192.168.1.87:48080/admin-api',
	  	// ip: 'http://1.sxzksz.com/admin-api',
	  	// ip: 'https://zkszjk.com/admin-api',
	  	ip: 'http://192.168.1.87:48080/admin-api',
	  	// ipTwo: 'http://sxmspa.sxzksz.com//app-api'
	},
    onLaunch: function() {
      this.initApp()
    },
    methods: {
      // 初始化应用
      initApp() {
		  console.log(111)
        // 初始化应用配置
        this.initConfig()
        // 检查用户登录状态
        //#ifdef H5
		let pathArr = ['/pages/wcLogin','/pages/login','/pages/wxLogin'];
		let isHave = false;
		for(let i=0;i<pathArr.length;i++){
			if(window.location.href.indexOf(pathArr[i]) >= 0){
				isHave = true;
				break;
			}
		}
		if(!isHave){
			this.checkLogin()
		}
        //#endif
      },
      initConfig() {
        this.globalData.config = config
      },
      checkLogin() {
        if (!getAccessToken()) {
			this.$tab.reLaunch('/pages/login')
        }
      }
    }
  }
</script>

<style lang="scss">
	/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
	@import "@/uni_modules/uview-ui/index.scss";
	@import '@/static/scss/index.scss'
	// uni-page{
	// 	min-height: 100%;
	// }
	
</style>
<style>
// uni-page-body,#app{
// 	min-height: 100%;
// }
uni-page{
	min-height: 100vh;
}
</style>
